package org.jeecg.modules.flow.callback.takestockplan;

import org.jeecg.modules.business.takestockplan.entity.TakeStockPlanExecute;
import org.jeecg.modules.business.takestockplan.service.ITakeStockPlanExecuteService;
import org.jeecg.modules.flow.sys.common.BaseCustomBeanRun;
import org.jeecg.modules.flow.sys.entity.dto.BaseFlowDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/*
 * 项目名称:    wms-server-jeecg
 * 接口描述:    盘点作业完成
 * 创建人员:    lumingyi
 * 创建时间:    2023-10-05
 */
@Component
public class TakeStockPlanExecuteFinishBean<T> extends BaseCustomBeanRun<T> {

    @Autowired
    private ITakeStockPlanExecuteService takeStockPlanExecuteService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void actureRun() {
        BaseFlowDto baseFlowDto = this.getBaseFlowDto();
        baseFlowDto.translateClass(TakeStockPlanExecute.class);
        TakeStockPlanExecute execute = (TakeStockPlanExecute) baseFlowDto.getData();

        takeStockPlanExecuteService.addTakeStockResult(execute.getId());
        baseFlowDto.setResult("生成盘盈盘亏单成功");
    }
}
